fix(clerk-js): Respect props passed to buildSignInUrl and buildSignUpUrl - #3361
Conversation
🦋 Changeset detectedLatest commit: a4ef2c6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| return sameOrigin ? stripOrigin(url) : `${url}`; | ||
| }; | ||
|
|
||
| export const appendAsQueryParams = ( |
There was a problem hiding this comment.
Killed this as we no longer need it
| } | ||
|
|
||
| // Keep just the pathname and the search | ||
| // Merge search params from the hashSearchParams object |
There was a problem hiding this comment.
All search params appended by clerk-js are snake_cased. Moved the logic here to make sure that the caller has to remember/think about this detail
| // Keep just the pathname and the search | ||
| // Merge search params from the hashSearchParams object | ||
| if (hashSearchParams) { | ||
| const paramsArr = Array.isArray(hashSearchParams) ? hashSearchParams : [hashSearchParams]; |
There was a problem hiding this comment.
Previously, the util supported passing hash params as a string only but the best way here is to simply pass a URLSearchParams object instead. I added the new functionality but kept the old one, will refactor all usages to the new format in a new PR
| ); | ||
| } | ||
|
|
||
| #flattenAll() { |
There was a problem hiding this comment.
I decided to stick with a more verbose approach here instead of a a more complex loop of some sort, let me know if you this is is too much
7697adb to
e607864
Compare
03ee073 to
7cd88d6
Compare
a73f777 to
b73c18e
Compare
buildSignInUrl and buildSignUpUrl
b73c18e to
99372db
Compare
|
!preview |
|
Hey @desiprisg, your preview is available.
|
|
!snapshot |
|
Hey @desiprisg - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/chrome-extension@1.0.8-snapshot.v99372db --save-exact
npm i @clerk/clerk-js@5.2.4-snapshot.v99372db --save-exact
npm i @clerk/elements@0.3.4-snapshot.v99372db --save-exact
npm i @clerk/clerk-expo@1.0.8-snapshot.v99372db --save-exact
npm i gatsby-plugin-clerk@5.0.0-beta.45 --save-exact
npm i @clerk/nextjs@5.0.8-snapshot.v99372db --save-exact
npm i @clerk/clerk-react@5.0.5-snapshot.v99372db --save-exact
npm i @clerk/remix@4.0.6-snapshot.v99372db --save-exact |
…Url across navigations
99372db to
a4ef2c6
Compare
desiprisg
left a comment
There was a problem hiding this comment.
LGTM but let's state that this won't work with core-2 app and core-1 account portal.
| #buildUrl = ( | ||
| key: 'signInUrl' | 'signUpUrl', | ||
| options: RedirectOptions, | ||
| _initValues?: Record<string, string>, |
There was a problem hiding this comment.
🙃 The _ prefix in parameters is used to mark unused parameters of a function. Are we sure about this naming?
Description
This PR updates the buildSignInUrl and buildSignUpUrl methods to correctly propagate the redirect props via URL search params. This allows the SignInButton and SignUpButton components to be configurable via their props as well.
Additionally, this PR:
Checklist
npm testruns as expected.npm run buildruns as expected.Type of change